home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Human Interface Toolbox / HandyScrollingSample / HandyWindow.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  7.0 KB  |  159 lines  |  [TEXT/MPS ]

  1. /*
  2.     File: HandyWindow.h
  3.     
  4.     Description:
  5.         This file contains the routine prototypes for calls defined in HandyWindow.c
  6.     These routines are used to take care of event handling and dispatching
  7.     events to the various event handlers.
  8.     
  9.     HandyWindow.c implements the routines used for drawing the windows
  10.     displayed by this application.
  11.  
  12.     Copyright:
  13.         © Copyright 2000 Apple Computer, Inc. All rights reserved.
  14.     
  15.     Disclaimer:
  16.         IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc.
  17.         ("Apple") in consideration of your agreement to the following terms, and your
  18.         use, installation, modification or redistribution of this Apple software
  19.         constitutes acceptance of these terms.  If you do not agree with these terms,
  20.         please do not use, install, modify or redistribute this Apple software.
  21.  
  22.         In consideration of your agreement to abide by the following terms, and subject
  23.         to these terms, Apple grants you a personal, non-exclusive license, under Apple’s
  24.         copyrights in this original Apple software (the "Apple Software"), to use,
  25.         reproduce, modify and redistribute the Apple Software, with or without
  26.         modifications, in source and/or binary forms; provided that if you redistribute
  27.         the Apple Software in its entirety and without modifications, you must retain
  28.         this notice and the following text and disclaimers in all such redistributions of
  29.         the Apple Software.  Neither the name, trademarks, service marks or logos of
  30.         Apple Computer, Inc. may be used to endorse or promote products derived from the
  31.         Apple Software without specific prior written permission from Apple.  Except as
  32.         expressly stated in this notice, no other rights or licenses, express or implied,
  33.         are granted by Apple herein, including but not limited to any patent rights that
  34.         may be infringed by your derivative works or by other works in which the Apple
  35.         Software may be incorporated.
  36.  
  37.         The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
  38.         WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
  39.         WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  40.         PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
  41.         COMBINATION WITH YOUR PRODUCTS.
  42.  
  43.         IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
  44.         CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  45.         GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  46.         ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION
  47.         OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
  48.         (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
  49.         ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  50.  
  51.     Change History (most recent first):
  52.         Tue, Feb 8, 2000 -- created
  53. */
  54.  
  55.  
  56. #ifndef __HANDYWINDOW__
  57. #define __HANDYWINDOW__
  58.  
  59. #define TARGET_API_MAC_CARBON 1
  60.  
  61. #include <Types.h>
  62. #include <Windows.h>
  63.  
  64.  
  65. /* OpenHandyWindow opens a handy window using the WIND resource
  66.     with the windowID ID. If successful, OpenHandyWindow returns a
  67.     pointer to the newly created window. if drawSlow is true, then the
  68.     window is set to draw the image slowly adding 1 tick per square
  69.     in the pattern. */
  70. WindowPtr OpenHandyWindow(short windowID, Boolean drawSlow);
  71.  
  72.  
  73. /* CloseAllHandyWindows closes every handy window
  74.     opened by calling OpenHandyWindow. */
  75. void CloseAllHandyWindows(void);
  76.  
  77.  
  78. /* HandyWindowUpdate should be called for update events
  79.     directed at a handy window.  It calls
  80.     BeginUpdate and EndUpdate and does all of the
  81.     drawing required to refresh the handy window. */
  82. OSErr HandyWindowUpdate(WindowPtr HandyWindow);
  83.  
  84.  
  85. /* HandyWindowActivate should be called for activate events
  86.     directed at the handy window. */
  87. OSErr HandyWindowActivate(WindowPtr theWindow, Boolean activate);
  88.  
  89.  
  90. /* HandyWindowCloseWindow closes the about box window. 
  91.     this routine deallocates any structures allocated
  92.     by the OpenHandyWindow. */
  93. OSErr HandyWindowCloseWindow(WindowPtr theWindow);
  94.  
  95.  
  96. /* FindHandyWindow iterates through the list of open handy windows
  97.     looking for a HandyWindowRecord containing a window pointer
  98.     matching the theWindow.  If one is found, a pointer to the
  99.     HandyWindowRecord is returned.  If there is no HandyWindowRecord
  100.     record for the window in the list of open handy windows, then
  101.     NULL is returned. */
  102. Boolean IsHandyWindow(WindowPtr HandyWindow);
  103.  
  104.  
  105. /* HandyWindowMouse is called when the mouse is clicked in the content
  106.     area of a window created by OpenHandyWindow.  where is a point in
  107.     the window's coordinates, and modifiers is the state of the modifier
  108.     keys copied from the event record. */
  109. OSErr HandyWindowMouse(WindowPtr theWindow, Point where, short modifiers);
  110.  
  111.  
  112. /* HandyWindowKey is called when a keydown event is received and
  113.     a handy window is frontmost.  Some users prefer to navigate using
  114.     the arrow keys, so this is often a useful facility to include in your
  115.     software. */
  116. OSErr HandyWindowKey(WindowPtr theWindow, char key, short modifiers);
  117.  
  118.  
  119. /* HandyWindowCursor is called when a handy window is the frontmost window and
  120.     the HandySample application is the frontmost application.  where is a point in
  121.     the window's coordinates, and modifiers is the state of the modifier
  122.     keys copied from the event record.  mouseRgn is a handle to a region.  If
  123.     HandyWindowCursor sets the cursor, then it will also set this region to
  124.     the region where it is appropriate for the cursor to remain as it has been
  125.     set (in global coordinates).  this region is appropriate for passing to WaitNextEvent
  126.     in the mouse region parameter. */
  127. Boolean HandyWindowCursor(WindowPtr HandyWindow, Point where, short modifiers, RgnHandle mouseRgn);
  128.  
  129.  
  130. /* GetHandyWindowGrowLimits sets the sizerect rectangle parameter
  131.     to values appropriate for passing to the GrowWindow routine. */
  132. OSErr GetHandyWindowGrowLimits(WindowPtr theWindow, Rect *sizerect);
  133.  
  134.  
  135. /* HandyWindowSizeChanged should be called whenever the size of a window
  136.     created by OpenHandyWindow has been changed by either a call to
  137.     ZoomWindow or SizeWindow. */
  138. OSErr HandyWindowSizeChanged(WindowPtr handyWindow);
  139.  
  140. /* HandyWindowScrollTo scrolls the to the location provided in
  141.     the position parameter.  The actual distance scrolled will be
  142.     restricted to the allowable scroll bar limits */
  143. OSErr HandyWindowScrollTo(WindowPtr theWindow, Point position);
  144.  
  145.  
  146.  
  147. /* HandyWindowGetSlow returns the state of the handy window's drawing
  148.     speed.  For illustration, it is possible to set the drawing speed to either
  149.     slow or fast. */
  150. OSErr HandyWindowGetSlow(WindowPtr theWindow, Boolean *drawnSlowly);
  151.  
  152. /* HandyWindowSetSlow sets the state of the handy window's drawing
  153.     speed and posts an update event so the contents will be re-drawn
  154.     showing the new speed.  For illustration, it is possible to set the
  155.     drawing speed to either slow or fast. */
  156. OSErr HandyWindowSetSlow(WindowPtr theWindow, Boolean drawSlowly);
  157.  
  158. #endif
  159.